<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <input type="text" v-model="unitprice" @keyup="calc" />
      <input type="text" v-model="qty" @keyup="calc" />
      <span>总价：{{total}}</span>
    </div>
    <script src="../lib/vue.js"></script>
    <script>
      let vm = new Vue({
        el: '#app',
        data: {
          total: 0,
          unitprice: 0,
          qty: 0,
        },
        methods: {
          calc: function () {
            this.total = this.qty * this.unitprice
          },
        },
      })
    </script>
  </body>
</html>
